<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="/WEB-INF/tlds/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN"><head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta charset="utf-8">
    <title>众游娱乐房卡系统</title>
    <meta name="keywords" content="关键词">
    <meta name="description" content="网站描述">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script>
    <!-- bootstrap & fontawesome -->
    
    <link rel="stylesheet" href="${pageContext.request.contextPath}/js/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/front/font-awesome.css">
    <!-- page specific plugin styles -->

    <!-- text fonts -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/front/ace-fonts.css">

    <!-- ace styles -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/front/ace.css" class="ace-main-stylesheet" id="main-ace-style">

    <!-- ace settings handler -->
    <script src="${pageContext.request.contextPath}/css/front/ace-extra.js"></script>

    <!-- md5 encrypt -->
    <script src="${pageContext.request.contextPath}/css/front/md5.js"></script>
<style type="text/css">
 .login-layout {
    background: url(${pageContext.request.contextPath}/images/banner.jpg) top center no-repeat;
    background-size: cover;
} 
.blur-login {
    background: #394557 url(${pageContext.request.contextPath}/images/meteorshower2.jpg) repeat;
}
.light-login {
    background: #dfe0e2 url(${pageContext.request.contextPath}/images/pattern.jpg) repeat;
}
</style>

<script type="text/javascript">
	$(function () {       
		var system ={}; 
        var p = navigator.platform;      
        system.win = p.indexOf("Win") == 0; 
        system.mac = p.indexOf("Mac") == 0; 
        system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);    
        if(system.win||system.mac||system.xll){
    		//如果是电脑跳转到弹出框 
        	//$("#mobile").val("0");
        }else{  
    		//如果是手机,跳转到页签
        	$("#mobile").val("1");
        }
        
      //更换验证码
    	$(".ui_code_btn").click(
    			function() {
    				$(".ui_code_img").attr(
    						"src",
    						"${pageContext.request.contextPath}/validateCode/getValidateCode.mt?s="
    								+ new Date());
    	});
    	$(".ui_code_img").click(
    			function() {
    				$(".ui_code_img").attr(
    						"src",
    						"${pageContext.request.contextPath}/validateCode/getValidateCode.mt?s="
    								+ new Date());
    	});
	});
</script>

</head>

<body class="login-layout">
 <%-- 由于本次的编写需要基于表单，同时还需要考虑到数据验证的问题，那么就可以不写row样式 --%>

<div class="main-container login-main-container">
    <div class="main-content">
        <div class="row">
            <div class="col-sm-10 col-sm-offset-1">
                <div class="login-container">
                    <div class="space-6"></div>

                    <div class="position-relative">
                        <div id="login-box" class="login-box visible widget-box no-border">
                            <div class="widget-body">
                                <div class="widget-main">
                                    <h4 class="header blue lighter bigger">
                                        <i class="ace-icon fa fa-coffee green"></i>
                                        <b>众游娱乐房卡系统</b>
                                    </h4>

                                    <div class="space-6"> </div>

                                    <form id="loginForm" action="${pageContext.request.contextPath}/admin/login.html" method="post" class="form-horizontal">
										<input type="hidden" name="mobile" id="mobile" value="1"  style="width:15px;">
                                        <div><label style="color:red;">${message}</label></div>
                                        <fieldset>
                                            <label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="text" id="loginNo" class="form-control" name="loginNo" placeholder="用户名">
															<i class="ace-icon fa fa-user"></i>
														</span>
                                            </label>
                                            <label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="password" id="password" class="form-control" name="password" placeholder="密码">
															<i class="ace-icon fa fa-lock"></i>
														</span>
                                            </label>
                                            <div class="space"></div>
                                            <!-- <label class="block clearfix">
														<span class="block input-icon ">
															<span class="inline"><input type="text" class="form-control" name="verify" placeholder="验证码" id="code" required=""></span>
                                                            <img style="cursor:pointer;" src="/Home/Login/verify.html" width="100" height="30" title="看不清楚？点击刷新" onclick="this.src = '/Home/Login/verify.html?'+new Date().getTime()">														</span>
                                            </label> -->
                                            
                                            <c:if test="${login_count>3}">
									            <div class="form-group" id="passwordDiv">
									               <!-- <label class="col-md-3 control-label" for="password">验证码：</label> -->
									               <div class="col-md-5">
													<input type="text" id="randCheckCode" placeholder="验证码" name="randCheckCode" class="form-verifyCode" id="LoginForm_verifyCode" style="width: 180px" />
													<img src="${pageContext.request.contextPath}/validateCode/getValidateCode.html" style="height: 34px;vertical-align: top;" alt="" class="ui_code_img" />
													<!--  <a href="javascript:;" class="ui_code_btn">换一张</a> -->
									               </div>
									               <div class="col-md-4" id="randCheckCodeSpan"></div>
									           </div>
											</c:if>

                                            <div class="space"></div>

                                            <div class="clearfix">
                                                <!--<label class="inline">
                                                    <input type="checkbox" class="ace" name="remember"/>
                                                    <span class="lbl"> 记住我</span>
                                                </label>-->
												<!-- <button type="submit" id="subBut" class="btn  btn-primary">登录</button>
                    							<button type="reset" id="rstBut" class="btn  btn-warning">重置</button> -->
												
                                                <button type="submit" onclick="return check()" class="width-35 pull-left btn btn-sm btn-primary" id="loginbtn">
                                                    <!-- <i class="ace-icon fa fa-key"></i> -->
                                                    <span class="bigger-110">登录</span>
                                                </button>
                                            </div>
											<c:if test="${login_count>2}">
											<div class="form-group" id="passwordDiv" >
								                <!-- <label class="col-md-3 control-label" for="password"></label> -->
								                <!-- <div class="col-md-5"> -->
								             	 	&nbsp;&nbsp;&nbsp;&nbsp;温馨提示：忘记密码请联系客服微信：13677461314
								               <!--  </div> -->
								                <div class="col-md-4" >    </div>
								           	</div>
								            </c:if>
                                            <div class="space-4"></div>
                                        </fieldset>
                                    </form>
                                    
                                    
                                </div><!-- /.widget-main -->
                            </div><!-- /.widget-body -->
                        </div><!-- /.login-box -->
                    </div><!-- /.position-relative -->

                    <div class="navbar-fixed-top align-right">
                        <br>
                        &nbsp;
                        <a id="btn-login-dark" href="#">Dark</a>
                        &nbsp;
                        <span class="blue">/</span>
                        &nbsp;
                        <a id="btn-login-blur" href="#">Blur</a>
                        &nbsp;
                        <span class="blue">/</span>
                        &nbsp;
                        <a id="btn-login-light" href="#">Light</a>
                        &nbsp; &nbsp; &nbsp;
                    </div>
                </div>
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.main-content -->
</div><!-- /.main-container -->

<!-- basic scripts -->



<!-- <![endif]-->


<!-- <script type="text/javascript">
    if('ontouchstart' in document.documentElement) document.write("<script src='/Public/qwadmin/js/jquery.mobile.custom.js'>"+"<"+"/script>");
</script> -->

<!-- inline scripts related to this page -->
<script type="text/javascript">
    jQuery(function($) {
        $(document).on('click', '.toolbar a[data-target]', function(e) {
            e.preventDefault();
            var target = $(this).data('target');
            $('.widget-box.visible').removeClass('visible');//hide others
            $(target).addClass('visible');//show target
        });
    });

    function check(){
    	var loginNo = $("#loginNo").val();
    	var password = $("#password").val();
    	if(loginNo==''){
    		alert("请输入用户名~");
    		return false;
    	}
    	
    	if(password==''){
    		alert("请输入密码~");
    		return false;
    	}
    }


    //you don't need this, just used for changing background
    jQuery(function($) {
        $('#btn-login-dark').on('click', function(e) {
            $('body').attr('class', 'login-layout');
            $('#id-text2').attr('class', 'white');
            $('#id-company-text').attr('class', 'blue');

            e.preventDefault();
        });
        $('#btn-login-light').on('click', function(e) {
            $('body').attr('class', 'login-layout light-login');
            $('#id-text2').attr('class', 'grey');
            $('#id-company-text').attr('class', 'blue');

            e.preventDefault();
        });
        $('#btn-login-blur').on('click', function(e) {
            $('body').attr('class', 'login-layout blur-login');
            $('#id-text2').attr('class', 'white');
            $('#id-company-text').attr('class', 'light-blue');

            e.preventDefault();
        });

    });
        $(function(){
        $('#loginbtn').click(function(){
            var username = $('#username').val().trim();
            var password = $('#password').val().trim();
            var code = $('#code').val().trim();
            if(username === ''){
                alert('用户名不能为空');
            }
            else{
                $.post('/Home/Login/getPassword',{user:username},function(d,s){
                    d = eval('('+d+')');
                    if(d.status == -1){
                        alert(d.msg);
                    }
                    else{
                        var npass = hex_md5(hex_md5(password + d.data.salt)+ d.data.rand);
                        var wi = {};
                        wi.user = username;
                        wi.password = npass;
                        wi.verify = code;
                        var data = $.param(wi);
                        var inputs = '';
                        $.each(data.split('&'), function () {
                            var pair = this.split('=');
                            inputs += '<input type="hidden" name="' + pair[0] + '" value="' + pair[1] + '" />';
                        });
                        $('<form action="' + '/Home/Login/check.html' + '" method="' + 'post' + '">' + inputs + '</form>').appendTo('body').submit().remove();
                    }
                })
            }
        });
    });
</script>
</body>
</html>